// pages/shop/meiye/detail.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    cates: [
      { title: '我要预约', icon:'https://www.58zltc.com/Public/can/meiye_icon1.png', url:'' },
      { title: '店铺产品', icon: 'https://www.58zltc.com/Public/can/meiye_icon2.png', url: '' },
      { title: '项目介绍', icon: 'https://www.58zltc.com/Public/can/meiye_icon3.png', url: '' },
      { title: '店铺详情', icon: 'https://www.58zltc.com/Public/can/meiye_icon4.png', url: '' },
    ],
    tabs: ['热门项目','推荐技师'],
    info: null,
    src: [],
    coupon_list: [],
    goods_list: [],
    tabIndex: 0,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log(this.data.tab_list);
    wx.showLoading({
      title: '加载中…',
    })
    let extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {};
    this.setData({
      token: extConfig.appid
    })
    wx.request({
      url: 'https://www.58zltc.com/api.php/Shop/item/shop_id/' + options.shop_id + '?token=' + this.data.token,
      success: res => {
        this.setData({
          info: res.data
        })
      }
    })
    wx.request({
      url: 'https://www.58zltc.com/api.php/Goods?shop_id=' + options.shop_id + '&token=' + this.data.token,
      success: res => {
        this.setData({
          goods_list: res.data
        })
      }
    })
    wx.request({
      url: 'https://www.58zltc.com/api.php/Coupon?shop_id=' + options.shop_id + '&token=' + this.data.token,
      success: res => {
        // this.setData({
        //   coupon_list: res.data
        // })
        wx.hideLoading()
      }
    })
  },
  setTab: function (e) {
    // console.log(e);
    var index = e.currentTarget.dataset.index;
    this.setData({
      tabIndex: index
    })
  },
  longtap: function (e) {
    var that = this;
    var url = e.currentTarget.dataset.src;
    this.data.src.push(url);
    wx.previewImage({
      urls: that.data.src
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})